package generate

// Define a code generation template
const (
	dtoTemplate = `package dto

type {{.ModelName}}AddDTO struct {
	{{range getColumns .}}
	{{.ModelName}} *{{.DomainType}} {{.DomainTag}} {{.ModelComment}}{{end}}
}

type {{.ModelName}}UpdateDTO struct {
	{{range getColumns .}}
	{{.ModelName}} *{{.DomainType}} {{.DomainTag}} {{.ModelComment}}{{end}}
}

type {{.ModelName}}SelectDTO struct {
	Page
}
`
	voTemplate = `package vo

type {{.ModelName}}Vo struct {
	{{range getColumns .}}
	{{.ModelName}} {{.DomainType}} {{.DomainTag}} {{.ModelComment}}{{end}}
}

func (a *{{.ModelName}}Vo) To(b *model.{{.ModelName}}Model) {
	var value any
	var err error
    {{range getColumns .}}
	value, err = b.{{.ModelName}}.Value()
	if err == nil {
		a.{{.ModelName}} = value.({{.DomainType}})
	}{{end}}
}
`
)
